APP_FILES = \
    app/jquery-1.8.1.min.js \
    app/housepenbox.min.js \
    app/booklet-ru.html \
    app/favicon.ico \
    app/housepenbox.html \
    app/housepenbox.css \
    app/apple-touch-icon-114x114.png \
    app/apple-touch-icon-114x114-precomposed.png \
    app/apple-touch-icon-144x144.png \
    app/apple-touch-icon-144x144-precomposed.png \
    app/apple-touch-icon-72x72.png \
    app/apple-touch-icon-72x72-precomposed.png \
    app/apple-touch-icon.png \
    app/apple-touch-icon-precomposed.png

DIST_FILES = \
    dist/housepenbox.js \
    dist/housepenbox.min.js

all:
	mkdir -p app
	make allx

clean:
	rm $(APP_FILES)
	rmdir app
	rm $(DIST_FILES)
	rmdir dist
	make -C doc clean

allx: $(APP_FILES)

app/jquery-1.8.1.min.js:
	wget -O $@ http://code.jquery.com/jquery-1.8.1.min.js

app/housepenbox.min.js: dist/housepenbox.min.js
	cat $< > $@

dist/housepenbox.min.js: src/*.js
	grunt

app/booklet-ru.html: doc/booklet-ru.html
	cat $< > $@

doc/booklet-ru.html:
	make -C doc

app/housepenbox.html: html/housepenbox.html
	cat $< > $@

app/housepenbox.css: html/housepenbox.css
	cat $< > $@

app/favicon.ico: media/favicon.ico
	cat $< > $@

app/%-precomposed.png: media/%.png
	cat $< > $@

app/%.png: media/%.png
	cat $< > $@

%64: %
	openssl base64 -e -in $< -out $@
